package jp.seraph.jsade.sexpression;

/**
 * Leafのデフォルト実装
 */
public class DefaultLeaf implements Leaf {
    public DefaultLeaf(String aValue){
        mValue = aValue;
    }

    private String mValue;

    
    public String getValue() {
        return mValue;
    }

    
    public int getValueAsInt() {
        return Integer.parseInt(mValue);
    }

    
    public double getValueAsDouble() {
        return Double.parseDouble(mValue);
    }

    
    public void accept(ExpressionVisitor aVisitor) {
        aVisitor.visit(this);
    }

    
    public int childCount() {
        return 0;
    }

    
    public SExpression getChild(int index) {
        return null;
    }

    
    public Leaf getChildAsLeaf(int index) {
        return null;
    }

    
    public Node getChildAsNode(int index) {
        return null;
    }

    
    public String getLeftString() {
        return this.getValue();
    }

    
    public boolean isLeaf() {
        return true;
    }

    
    public boolean isNode() {
        return false;
    }

}
